<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>部门管理</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../../layui/css/layui.css" media="all">
     <link rel="stylesheet" href="../../static/css/style.css"  media="all">
    <!-- <link rel="stylesheet" href="../../static/css/zTreeStyle/zTreeStyle.css" />-->
    <link rel="stylesheet" href="../../static/zTree_v3/css/zTreeStyle/zTreeStyle.css" type="text/css">
    <link rel="stylesheet" href="../../static/zTree_v3/css/metroStyle/metroStyle.css" type="text/css">
    <script type="text/javascript" src="../../static/js/jquery.min.js"></script>
    <script type="text/javascript" src="../../layui/layui.all.js" charset="utf-8"></script>
    <script type="text/javascript" src="../../static/js/jquery.cookie.js"></script>
    <script type="text/javascript" src="../../static/js/base.js" charset="utf-8"></script>
    <script type="text/javascript" src="../../static/js/ax.js"></script>
    <!-- <script type="text/javascript" src="../../static/js/jquery.ztree.core.js" ></script>-->
    <script type="text/javascript" src="../../static/zTree_v3/js/jquery.ztree.core.js"></script>
    <script type="text/javascript" src="../../static/zTree_v3/js/jquery.ztree.excheck.js"></script>
    <script type="text/javascript" src="../../static/zTree_v3/js/jquery.ztree.exedit.js"></script>

    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
    <script src="../../static/js/html5.js"></script>
    <script src="../../static/js/respond.js"></script>
    <![endif]-->
</head>
<body class="bg_w">
<div class="layui-fluid">
    <div class="content-wrap">
        <div class="layui-row">
            <div class="layui-row layui-col-space15">
                <div class="layui-col-sm4">
                    <label class="layui-form-label">总校名称</label>
                    <div class="layui-input-block">
                        <input type="text" name="depName" id="depName" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-col-xs4">
                    <button class="layui-btn add_btn" data-type="reload" onclick="searchBtn()"><i
                            class="layui-icon layui-icon-search"></i>搜索
                    </button>
                </div>
            </div>
            <div class="layui-col-md2">
                <table id="department" class="layui-hide" lay-filter="eventBtn"></table>
                <input type="hidden" name="departmentCode" id="departmentCode">
                <input type="hidden" name="departmentName" id="departmentName">
            </div>
        </div>
    </div>
</div>

<script>
    var tableIns;
    var depType = getQueryString('depType');
    var parentCode= getQueryString('parentCode');
    $(document).ready(function () {
        layui.use(['table', 'layer', 'element'], function () {
            var table = layui.table, element = layui.element;
            tableIns = ax.VTable({
                elem: "#department",
                url: backendWebUrl+'/api/school/department/list',
                where: {
                    depType: depType,
                    parentCode:parentCode
                },
                method: 'POST',
                cols: [[
                    {field: '序列号', width: 80, title: '序列号', sort: true, type: 'numbers'},
                    {field: 'name', title: '驾校名称'},
                    {field: 'created', title: '创建时间'}
                ]]
            });
            //监听行单击事件（单击事件为：rowDouble）
            table.on('row(eventBtn)', function (obj) {
                var depJson = obj.data;
                $("#departmentCode").val(depJson.depCode);
                $("#departmentName").val(depJson.name);
                //标注选中样式
                obj.tr.addClass('layui-table-click').siblings().removeClass('layui-table-click');
            });


        });
    });

    function searchBtn() {
        tableIns.reload({
            page: {curr: 1},
            where: {
                type:type,
                parentCode:parentCode,
                depName: $("#depName").val()
            }
        });
    };

</script>
</body>
</html>